import store from 'react-native-simple-store'
/**
 * 设置登录缓存信息 token phone
 */
export function setLoginInfo(obj) {
  if (obj) {
    store.save('token', obj.token ? obj.token : '')
  } else {
    store.save('token', '')
  }
}

/**
 * 获取登录缓存信息 token
 */
export async function getLoginInfo() {
  const token = await store.get('token')
  return {
    token: token || '',
  }
}

/**
 * 缓存cookie cookie
 */
export function setCookie(cookie) {
  // alert('set----'+cookie)
  store.save('cookie', cookie ? cookie : '')
}

/**
 * 获取缓存cookie cookie
 */
export async function getCookie() {
  const cacheCookie = await store.get('cookie')
  // alert('2222'+cacheCookie)
  return {
    cacheCookie: cacheCookie || '',
  }
}